package org.example.lotterysystem.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.example.lotterysystem.common.errorcode.ErrorCode;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2025-03-28  10:47
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException {
    /**
     * @see org.example.lotterysystem.common.errorcode.ControllerErrorCodeConstants
     */
    private Integer code;
    private String message;

    public ControllerException(){

    }

    public ControllerException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ControllerException(ErrorCode errorCode){
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }
}
